package cn.fastoo.web.backstage.web.controller.system;

import cn.fastoo.common.dao.system.AdminSystemConfigDao;
import cn.fastoo.common.dao.system.AdminSystemOrganizationDao;
import cn.fastoo.common.entity.system.AdminSystemConfig;
import cn.fastoo.common.entity.system.AdminSystemOrganization;
import cn.fastoo.common.sampleframe.dto.JsonResult;
import cn.fastoo.common.sampleframe.search.QuerySearch;
import cn.fastoo.common.sampleframe.search.Search;
import com.alibaba.fastjson.JSONArray;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;


/**
 * 用户页面 控制器.
 */
@Controller
@RequestMapping("/system/config")
public class AdminSystemConfigController {
	private static Logger logger = LoggerFactory.getLogger(AdminSystemConfigController.class);

	@Autowired
	private AdminSystemConfigDao dao;

	@RequestMapping
	public String index() {
		return "/system/config/index";
	}

	@RequestMapping("配置管理页")
	public String all() {
		return "/system/config/配置管理页";
	}


	@RequestMapping("/getALL")
	@ResponseBody
	public String getALL() {
		return JsonResult.success(dao.find(new Search()));
	}

	@RequestMapping("/save")
	@ResponseBody
	public String save(String json) {
		dao.save(JSONArray.parseArray(json,AdminSystemConfig.class));
		return JsonResult.success("ok");
	}



}
